﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <HEAD>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>工作计划项  <{$smarty.const.WEB_NAME}></title>
	<link rel="stylesheet" type="text/css" href="./skin/default/style.css" />
	<script type="text/javascript" src="./skin/default/comm.js"></script> 
	<script type="text/javascript" src="./skin/default/calendar.js"></script>
	<style type="text/css">
		  body	{font-size:13px;}
	</style>
 </HEAD>

 <BODY>
	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		  <tr> 
			<th width="50%" align="center"><a href="?q=workManage/viewWorkPlan">查看本部门工作计划</a></th>
			<th width="50%" align="center"><a href="#" onclick="AddPlanItem(<{$workPlanId}>)">新增计划项</a></th>
		  </tr>
	  </table>
	  <table width="100%" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="tableList tip_bug" style="font-size:13px;">
		  <tr> 
			<th width="3%" align="center">编号</th>
			<th width="10%" align="center">创建时间</th>
			<th width="29%" align="center">计划内容</th>
			<th width="4%" align="center">优先级</th>
			<th width="6%" align="center">员工</th>
			<th width="4%" align="center">工时</th>
			<th width="6%" align="center">开始时间</th>
			<th width="6%" align="center">结束时间</th>
			<th width="5%" align="center">开发情况</th>
			<th width="5%" align="center">测试情况</th>
			<th width="10%" align="center">操作</th>
			<th width="12%" align="center">备注</th>
		  </tr>
		  <{section name=itm loop=$workPlanItemList}>
			<{assign var="planItemId" value=$workPlanItemList[itm].id}>
			<{assign var="createTime" value=$workPlanItemList[itm].createTime}>
			<{assign var="planContent" value=$workPlanItemList[itm].planContent}>
			<{assign var="level" value=$workPlanItemList[itm].level}>
			<{assign var="employees" value=$workPlanItemList[itm].employees}>
			<{assign var="planWorkTime" value=$workPlanItemList[itm].planWorkTime}>
			<{assign var="startTime" value=$workPlanItemList[itm].starttime}>
			<{assign var="endTime" value=$workPlanItemList[itm].endtime}>
			<{assign var="developState" value=$workPlanItemList[itm].developState}>
			<{assign var="testState" value=$workPlanItemList[itm].testState}>
			<{assign var="memo" value=$workPlanItemList[itm].memo}>
		  <tr>
			<td align="center"><{$planItemId}></td>
			<td align="center"><{$createTime}></td>
			<td><a href="?q=workManage/viewWorkTask&mode=plan&planItemId=<{$planItemId}>"><{$planContent}></a></td>
			<td align="center">
				<{if $level == 1}>
					高
				<{elseif $level == 2}>
					中
				<{elseif $level == 3}>
					低
				<{else}>
					未知
				<{/if}>
			</td>
			<td align="center"><{$employees}></td>
			<td align="center"><{$planWorkTime}></td>
			<td align="center"><{$startTime}></td>
			<td align="center"><{$endTime}></td>
			<td align="center">
				<{if $developState == 0}>
					未开始
				<{elseif $developState == 1}>
					进行中
				<{elseif $developState == 2}>
					已完成
				<{elseif $developState == 3}>
					不解决
				<{else}>
					未知
				<{/if}>
			</td>
			<td align="center">
				<{if $testState == 0}>
					未通过
				<{elseif $testState == 1}>
					通过
				<{else}>
					未知
				<{/if}>
			</td>
			<td align="center">
				<a href="?q=workManage/viewWorkTaskItem&userId=<{$smarty.session.id}>&planItemId=<{$planItemId}>&taskName=<{$planContent}>"><u>创建任务</u></a>
				<a href="#" onclick="UpdatePlanItem(<{$workPlanId}>, this)"><u>修改</u></a>
				<a href="javascript:GoDeleteUrl(<{$workPlanId}>, <{$planItemId}>)"><u>删除</u></a>
			</td>
			<td align="center"><{$memo}></td>
		  </tr>
		  <{/section}>
	  </table>

	  <table id="editPlanItem" border="1" cellspacing="0" bordercolor="#cfcfcd" cellpadding="0" class="msg_box driftWindow" style="font-size:13px; display:none; width:500px; left:320px; top:50px">
		<form method="post" name="editPlanItemForm" id="editPlanItemForm" onsubmit="return CheckPlanItem()" action="?q=workManage/editPlanItem">	
		 <tr class="tit">
		   <th align="center" colspan="2">编辑计划项</th>
		   <input type="hidden" name="editPlanId" id='editPlanId' value="" />
		   <input type="hidden" name="editPlanItemId" id='editPlanItemId' value="" />
		   <input type="hidden" name="editDeptId" value="<{$smarty.session.departmentId}>" />
		   <input type="hidden" name="editUserId" value="<{$smarty.session.id}>" />
		 </tr>
		 <tr>
			<td width="120" align="center">计划项</td>
			<td height="50px">
				<textarea name="editItemContent" id="editItemContent" style="margin-left:20px; width:320px; height:60px; border:none; overflow:auto"></textarea>
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">优先级</td>
			<td>
			<select name="editLevel" id="editLevel" style="margin-left:20px" >
				<option value="1">高</option>
				<option value="2" selected="selected">中</option>
				<option value="3">低</option>
			</select>
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">员工</td>
			<td>
				<input type="text" name="editEmployees" id="editEmployees" value="" style="margin-left:20px;"/>
			<td>
		 </tr>
		 <tr>
			<td width="120" align="center">工时</td>
			<td>
				<input type="text" name="editWorkTime" id="editWorkTime" value="0" style="margin-left:20px;"/>&nbsp;&nbsp;天
			<td>
		 </tr>
		 <tr>
			<td width="120" align="center">开始时间</td>
			<td>
				<input type="text" name="editStartTime" id="editStartTime" value="" class="dateInput" style="margin-left:20px;" onclick="MyCalendar.SetDate(this)" /> 
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">结束时间</td>
			<td>
				<input type="text" name="editEndTime" id="editEndTime" value="" class="dateInput" style="margin-left:20px;" onclick="MyCalendar.SetDate(this)" /> 
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">开发情况</td>
			<td>
			<select name="editDevelopState" id="editDevelopState" style="margin-left:20px">
				<option value="0">未开始</option>
				<option value="1" selected="selected">进行中</option>
				<option value="2">已完成</option>
				<option value="3">不解决</option>
			</select>
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">测试情况</td>
			<td>
			<select name="editTestState" id="editTestState" style="margin-left:20px">
				<option value="0">未通过</option>
				<option value="1" selected="selected">通过</option>
			</select>
			</td>
		 </tr>
		 <tr>
			<td width="120" align="center">备注</td>
			<td height="50px">
				<textarea name="editMemo" id="editMemo" style="margin-left:20px; width:320px; height:40px; border:none; overflow:auto"></textarea>
			</td>
		 </tr>
		 <tr>
			<td align="center" colspan="2">
			  <input type="submit" class="submit" value="提交">
			  <input type="button" value="关闭" onclick="HiddenPlanItem()" class="submit"/>
			</td>
		 </tr>
		</form>
      </table>

	<script type="text/javascript">
	<!--
		function AddPlanItem(planId) {
			$('editPlanId').value = planId;
			$('editPlanItemId').value = '';
			$('editItemContent').value = '';
			$('editLevel').value = '1';
			$('editEmployees').value = '';
			$('editWorkTime').value = '';
			$('editStartTime').value = '';
			$('editEndTime').value = '';
			$('editDevelopState').value = '0';
			$('editTestState').value = '0';
			$('editMemo').value = '';
			$('editPlanItem').style.display = "block";
		}

		function UpdatePlanItem(planId, object) {
			var trObj = object.parentElement.parentElement;
			var itemId = trObj.cells(0).innerText;
			var content = trObj.cells(2).innerText;
			var level = trObj.cells(3).innerText;
			if( level.charCodeAt() == "高".charCodeAt() ) {
				level = 1;
			} else if( level.charCodeAt() == "中".charCodeAt() ) {
				level = 2;
			} else {
				level = 3;
			}
			var employees = trObj.cells(4).innerText;
			var workTime = trObj.cells(5).innerText;
			workTime = parseFloat( workTime );
			var startTime = trObj.cells(6).innerText;
			var endTime = trObj.cells(7).innerText;
			var developState = trObj.cells(8).innerText;
			if( developState.charCodeAt() == "进行中".charCodeAt() ) {
				developState = 1;
			} else if( developState.charCodeAt() == "已完成".charCodeAt() ) {
				developState = 2;
			} else if( developState.charCodeAt() == "不解决".charCodeAt() ) {
				developState = 3;
			} else {
				developState = 0;
			}
			var testState = trObj.cells(9).innerText;
			if( testState.charCodeAt() == "通过".charCodeAt() ) {
				testState = 1;
			} else {
				testState = 0;
			}
			var memo = trObj.cells(11).innerText;

			$('editPlanId').value = planId;
			$('editPlanItemId').value = itemId;
			$('editItemContent').value = content;
			$('editLevel').value = level;
			$('editEmployees').value = employees;
			$('editWorkTime').value = workTime;
			$('editStartTime').value = startTime;
			$('editEndTime').value = endTime;
			$('editDevelopState').value = developState;
			$('editTestState').value = testState;
			$('editMemo').value = memo;
			$('editPlanItem').style.display = "block";
		}

		function HiddenPlanItem() {
			$('editPlanItem').style.display = "none";
		}

		function CheckPlanItem() {
			planId = $('editPlanId').value;
			if( planId <= 0 ) {
				window.alert( "计划ID非法: planId=" + planId );
				return false;
			}

			if( $('editItemContent').value.trim().length < 5 ) {
				window.alert( "计划项内容太少，至少5个字吧" );
				return false;
			}

			if( $('editWorkTime').value.trim().length < 1 ) {
				$('editWorkTime').value = 0;
			} else {
				$('editWorkTime').value = parseFloat($('editWorkTime').value);
			}

			return true;
		}

		function GoDeleteUrl( planId, planItemId ) {
			if( confirm( "你确认要删除吗?") ) {
				location.href = "?q=workManage/deleteWorkPlanItem&planItemId=" 
					+ planItemId + "&planId=" + planId;
			}
		}
	//-->
	</script>
 </BODY>
</HTML>
